﻿<Window x:Class="Ellanet.Windows.AnswersWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:converters="clr-namespace:Ellanet.Converters"
        xmlns:classes="clr-namespace:Ellanet.Classes"
        mc:Ignorable="d"
        Title="ResultsWindow" Height="660" Width="300" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" ShowActivated="True" Topmost="True" AllowsTransparency="True" Background="Transparent">
    <Window.Resources>
        <converters:IntToImageSourceListConverter x:Key="IntToImageSourcesConverter"/>
        <DataTemplate DataType="{x:Type classes:Sum}">
            <Grid Margin="5">
                <Grid.Resources>
                    <Style TargetType="Image" x:Key="StandardImageStyle">
                        <Setter Property="Stretch" Value="Uniform"/>
                        <Setter Property="Height" Value="40"/>
                        <Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality"/>
                        <Setter Property="Opacity" Value="1.0"/>
                    </Style>
                </Grid.Resources>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="45"/>
                    <ColumnDefinition Width="40"/>
                    <ColumnDefinition Width="45"/>
                    <ColumnDefinition Width="40"/>
                    <ColumnDefinition Width="75"/>
                </Grid.ColumnDefinitions>
                <ItemsControl Grid.Column ="0" ItemsSource="{Binding Path=Multiplicand, NotifyOnTargetUpdated=True, Converter={StaticResource IntToImageSourcesConverter}}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Image Source="{Binding}" Style="{StaticResource StandardImageStyle}"/>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
                <Image Grid.Column="1" Source="/Resources/X_Purple.png" Style="{StaticResource StandardImageStyle}" Width="24"/>
                <ItemsControl Grid.Column ="2" ItemsSource="{Binding Path=Multiplier, NotifyOnTargetUpdated=True, Converter={StaticResource IntToImageSourcesConverter}}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Image Source="{Binding}" Style="{StaticResource StandardImageStyle}"/>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
                <Image Grid.Column="3" Source="/Resources/Equals_Purple.png" Style="{StaticResource StandardImageStyle}" Width="24"/>
                <ItemsControl Grid.Column ="4" ItemsSource="{Binding Path=Answer, NotifyOnTargetUpdated=True, Converter={StaticResource IntToImageSourcesConverter}}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Image Source="{Binding}" Style="{StaticResource StandardImageStyle}">
                                <!--<Image.Effect>
                                    <DropShadowEffect ShadowDepth="0" Color="LightGreen" Opacity="1.0" BlurRadius="50"/>
                                </Image.Effect>-->
                            </Image>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </Grid>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Rectangle Style="{StaticResource BackgroundRectangleStyle}"/>
        <Button IsCancel="True" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="20" Click="CloseButton_OnClick">
            <Button.Style>
                <Style TargetType="Button" BasedOn="{StaticResource NoChromeButton}">
                    <Setter Property="Cursor" Value="Hand"/>
                    <Setter Property="Height" Value="16"/>
                    <Setter Property="Width" Value="16"/>
                </Style>
            </Button.Style>
            <Image>
                <Image.Style>
                    <Style TargetType="{x:Type Image}">
                        <Setter Property="Source" Value="/Resources/X_Blue_32x32.png"/>
                        <Style.Triggers>
                            <Trigger Property ="IsMouseOver" Value="True">
                                <Setter Property="Source" Value="/Resources/X_Yellow_32x32.png"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Image.Style>
            </Image>
        </Button>
        <ItemsControl ItemsSource="{Binding Path=Sums, NotifyOnTargetUpdated=True, Mode=OneWay}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        <!--<Button Grid.Column="0" IsCancel="True" Opacity="0.0" Width="1" Height="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="CloseButton_OnClick"/>-->
        <Border Style="{StaticResource WindowBorderStyle}"/>
    </Grid>
</Window>
